package com.internetCafes.spms.web.customer.common.cont;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 客户常量
 */
public class CustomerConst {

    /**
     * 跟进日志内容长度最低
     */
    public static final Integer FOLLOW_CONTENT_LENGTH_LOWER = 20;

    /**
     * 资质无，匹配
     */
    public final static String QUALI_CONTENT_NULL = "无";

    /**
     * 是否是企业客户标签
     */
    public enum ENTERPRISE {

        DEFAULT(0, "默认"),
        YES(1,"企业客户")

        ;
        private Integer id;

        private String comment;

        ENTERPRISE(Integer id, String comment) {
            this.id = id;
            this.comment = comment;
        }

        public Integer getId() {
            return id;
        }

        public String getType() {
            return comment;
        }
    }

    /**
     * 标记类型枚举
     */
    public enum MarkType {
        UN_NECESSARY(1, "不需要客户标签（E类标签标注）"),
        ;
        private Integer id;

        private String type;

        MarkType(Integer id, String type) {
            this.id = id;
            this.type = type;
        }

        public Integer getId() {
            return id;
        }

        public String getType() {
            return type;
        }

        public static List<Integer> getTypeIdList() {
            return Arrays.stream(values())
                    .map(MarkType::getId)
                    .collect(Collectors.toList());
        }
    }

    /**
     * 操作actionTag
     */
    public enum FlowPoListActionTag {

        WEEK_COUNT(1, "每周统计跟进"),
        ;
        private Integer id;

        private String type;

        FlowPoListActionTag(Integer id, String type) {
            this.id = id;
            this.type = type;
        }

        public Integer getId() {
            return id;
        }

        public String getType() {
            return type;
        }
    }

    /**
     * 操作类型 类型id 1-进款 2-退款 3-挂靠
     */
    public enum CooperationType {
        DEPOSIT(1, "进款"),
        REFUND(2, "退款"),
        ANCHOR(3, "挂靠"),
        ;
        private Integer id;

        private String type;

        CooperationType(Integer id, String type) {
            this.id = id;
            this.type = type;
        }

        public Integer getId() {
            return id;
        }

        public String getType() {
            return type;
        }

        public static List<Integer> getIdList() {
            return Arrays.stream(values()).map(CooperationType::getId).collect(Collectors.toList());
        }

        public static Integer getIdByType(String typeName) {
            for (CooperationType type: values()) {
                if (type.getType().equals(typeName)) {
                    return type.getId();
                }
            }
            return null;
        }

        public static String getTypeById(Integer id) {
            for (CooperationType type: values()) {
                if (type.getId().equals(id)) {
                    return type.getType();
                }
            }
            return "";
        }
    }

    /**
     * 获取可转让部门人员树
     * 使用场景id
     */
    public enum TransferUserTreeAction {

        CUSTOMER_TRANSFER(1, "客户转让"),
        CUSTOMER_SEARCH(2, "客户搜索"),

        ;

        /**
         * id
         */
        private Integer id;

        /**
         * 使用场景
         */
        private String action;

        TransferUserTreeAction(Integer id, String action) {
            this.id = id;
            this.action = action;
        }

        public Integer getId() {
            return id;
        }

        public String getAction() {
            return action;
        }
    }

    /**
     * 操作标签
     * 1-创建 2-跟进人变更 3-删除 4-转意向 5-转成交 6-意向移除 7-成交移除
     */
    public enum FlowActionTag {
        CREATE(1, "创建"),
        FLOW_USER_CHANGE(2, "跟进人变更"),
        DELETE(3, "删除"),
        TO_INTENTION(4, "转意向"),
        TO_DEAL(5, "转成交"),
        INTENTION_MOVE(6, "意向移除"),
        DEAL_MOVE(7, "成交移除"),
        ;
        /**
         * id
         */
        private Integer id;

        /**
         * 标签
         */
        private String tag;

        FlowActionTag(Integer id, String tag) {
            this.id = id;
            this.tag = tag;
        }

        public Integer getId() {
            return id;
        }

        public String getTag() {
            return tag;
        }

        public static FlowActionTag getTagById(Integer id) {
            for (FlowActionTag tag : values()) {
                if (tag.getId().equals(id)) {
                    return tag;
                }
            }
            return null;
        }
    }

    /**
     * 来源途径 1-企业考生（输入企业名称）、2-考生介绍、3-公众号、4-陌生电话、5-其他（自己输入）
     */
    public enum OriginTag {
        ENT(1, "企业考生"),
        EXAMINEE(2, "考生介绍"),
        WECHAT_OFFICIAL_ACCOUNT(3, "公众号"),
        UNFAMILY_PHONE(4, "陌生电话"),
        OTHERS(5, "其他"),
        ;

        /**
         * id
         */
        private Integer id;

        /**
         * 标签
         */
        private String tag;

        OriginTag(Integer id, String tag) {
            this.id = id;
            this.tag = tag;
        }

        public Integer getId() {
            return id;
        }

        public String getTag() {
            return tag;
        }

        public static String getTagById(Integer id) {
            for (OriginTag originTag : values()) {
                if (originTag.getId().equals(id)) {
                    return originTag.getTag();
                }
            }
            return "";
        }

        public static List<Integer> getIdList() {
            return Arrays.stream(values()).map(OriginTag::getId).collect(Collectors.toList());
        }

        public static Integer getIdByTag(String tag) {
            for (OriginTag originTag : values()) {
                if (originTag.getTag().equals(tag)) {
                    return originTag.getId();
                }
            }
            return null;
        }
    }

    /**
     * 客户类别 1-成交客户 2-意向客户 3-一般客户
     */
    public enum TypeEnum {
        DEAL(1, "成交客户"),
        INTENTION(2, "意向客户"),
        GENERAL(3, "一般客户"),
        ;

        private Integer id;

        private String type;

        TypeEnum(Integer id, String type) {
            this.id = id;
            this.type = type;
        }

        public Integer getId() {
            return id;
        }

        public String getType() {
            return type;
        }

        public static List<Integer> getIdList() {
            return Arrays.stream(values()).map(TypeEnum::getId).collect(Collectors.toList());
        }
    }
}
